#if (ARDUINO >= 100)
#include <Arduino.h>
#else
#include <WProgram.h>
#include <pins_arduino.h>
#endif

#include <colors.h>

class LPD8806
{

  public:

  LPD8806(uint16_t n, uint8_t stripes);

  void begin(void);
  void show(void);
  void setPixelColor(uint16_t pos, rgb_t rgb, uint8_t stripe);
  void setPixelColor(uint8_t pos, rgb_t color);
  void setStripeColor(rgb_t rgb, uint8_t stripe);
  void clear(void);
  rgb_t convertRGB(uint32_t color);
  void updateLength(uint16_t n);  
  rgb_t getPixelColor(uint8_t pos);
  uint16_t getNumPixels(void);

  private:

  uint16_t numLEDs;///< Number of RGB LEDs in a complete stripe
  uint8_t* pPixels;///< RGB LED color values (3 bytes each)
  uint8_t* pPixelBak;  //backup pointer
  uint8_t nStripes;///< Number of Stripe Pieces

  void writeArray(uint8_t position, rgb_t rgb);
};
